import { Module } from '@nestjs/common';
import { ListService } from './list.service';
import { HomeService } from 'src/home/home.service';
import { ListController } from './list.controller';

@Module({
  controllers: [ListController],
  // 提供者可以是类，也可以是值或工厂函数。
  providers: [
    HomeService,
    {
      provide: 'ABC',
      useClass: ListService,
    },
    {
      provide: 'XYZ',
      useValue: {
        name: '[Pdd,tb,jd]',
      },
    },
    {
      provide: 'CCC',
      inject: [HomeService],
      useFactory: (HomeService: HomeService) => {
        console.log(HomeService.findAll());
        return 100000;
      },
    },
  ],
})
export class ListModule {}
